
import { Button } from 'antd';
import './TodoList.scss'
import { useState } from 'react';

const Bottom = (props) => {
    console.log(props.data);

    const [data, Dal] = useState(props)
    const dal = (index) => {
        console.log(index);
        props.data.data.splice(index, 1)
        let dataArr = data.data
        Dal({ data: dataArr })
    }

    return (
        <>
            <div className='TodoList'>
                <div className='title'>
                    内容
                </div>
                <ul>
                    {
                        props.data.data.map((item, index) => {
                            console.log(item);
                            return (
                                <li key={index}>
                                    <span>标题：{item.headline}</span>
                                    <span>日期：{item.date}</span>
                                    <span>优先级：{item.priority}</span>
                                    <Button className='Button' onClick={() => dal(index)}>删除</Button>
                                </li>
                            )
                        })
                    }
                </ul>
            </div>
        </>
    );
};
export default Bottom;